Texture2D shaderTexture;
SamplerState SampleType;

cbuffer LightBuffer
{
	float4 diffuseColor;
	float3 lightDirection;
	float padding;
};

struct PixelInputType
{
	float4 position : SV_POSITION;
	float2 tex : TEXCOORD0;
	float3 normal : NORMAL;
};


float4 LightPixelShader(PixelInputType input) : SV_TARGET
{
	float4 textureColor;
	float3 lightDir;
	float lightIntensity;
	float4 color;


	// sample the pixel color from the texture using the sampler at this texture coordinate location
	textureColor = shaderTexture.Sample(SampleType, input.tex);


	// invert the light direction for calculations
	lightDir = -lightDirection;

	// calculate the amount of light on this pixel
	lightDir = normalize(lightDir);
	lightIntensity = saturate(dot(input.normal, lightDir));

	// determine the final amount of diffuse color based on the diffuse color combined with the light intensity
	color = saturate(diffuseColor * lightIntensity);

	// multiply the texture pixel and the final diffuse color to get the final pixel color result
	color = color + float4(0.1f, 0.1f, 0.1f, 1.0f);// * textureColor;

	return color;

}